package extend.part6;

// 父类：Person
class Person {
    protected String name;
    public Person(String name) {
        this.name = name;
    }
    @Override
    public String toString() {
        return name;
    }
}

// 子类：Student（继承自Person）
class Student extends Person {
    private int studentId;
    public Student(String name, int studentId) {
        super(name);
        this.studentId = studentId;
    }
    @Override
    public String toString() {
        return "Student{" + name + ", id=" + studentId + "}";
    }
}

// 子类：Teacher（继承自Person）
class Teacher extends Person {
    private int teacherId;
    public Teacher(String name, int teacherId) {
        super(name);
        this.teacherId = teacherId;
    }
    @Override
    public String toString() {
        return "Teacher{" + name + ", id=" + teacherId + "}";
    }
}